package com.df.ez_game.server.logic;

import com.df.ez_game.server.ServerNode;
import com.df.ez_game.server.msg.client.ClientReqMsg;
import com.df.ez_game.server.req_metadata.ControllerMetadatas;
import com.df.ez_game.server.req_metadata.EzMethodData;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class ClientMsgDispatcherHandler extends SimpleChannelInboundHandler<ClientReqMsg> {
    ServerNode serverNode;

    public ClientMsgDispatcherHandler(ServerNode serverNode){
        this.serverNode = serverNode;
    }

    @Override
    protected void channelRead0(ChannelHandlerContext channelHandlerContext, ClientReqMsg clientReqMsg) throws Exception {
        LogicServerNode logicServerNode = (LogicServerNode) serverNode;
        logicServerNode.getDispatcher().dispacher(logicServerNode,clientReqMsg,channelHandlerContext);
    }
}
